package edu.zju.gis.dldsj.service.impl;

import edu.zju.gis.dldsj.dao.DsInfoMapper;
import edu.zju.gis.dldsj.entity.DsInfo;
import edu.zju.gis.dldsj.service.DsInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yanlo yanlong_lee@qq.com
 * @version 1.0 2018/08/02
 */
@Service
public class DsInfoServiceImpl implements DsInfoService {
    @Autowired
    private DsInfoMapper dsInfoMapper;

    @Override
    public DsInfo select(String pk) {
        return dsInfoMapper.selectByPrimaryKey(pk);
    }

    @Override
    public int insert(DsInfo dsInfo) {
        return dsInfoMapper.insertSelective(dsInfo);
    }

    @Override
    public void update(DsInfo dsInfo) {
        dsInfoMapper.updateByPrimaryKeySelective(dsInfo);
    }

    @Override
    public void delete(String s) {
        dsInfoMapper.deleteByPrimaryKey(s);
    }

    @Override
    public boolean isExist(String s) {
        return dsInfoMapper.selectByPrimaryKey(s) != null;
    }

    @Override
    public List<DsInfo> getByPage(int offset, int size) {
        return dsInfoMapper.selectByPage(offset, size);
    }
}
